# 选择排序法：
# [5,8,1,9,23,88,4]
numbers = [5,8,1,9,23,88,4]

# 0,1,2,3,4,5,6

for i in range(0, len(numbers)): # [0, 7)
    maxIdx = i  #最大值下标
    for j in range(i+1, len(numbers)): # [i+1, 7)
        if numbers[j] > numbers[maxIdx]:
            numbers[j], numbers[maxIdx] = numbers[maxIdx], numbers[j]


print(numbers)